﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Wpf.Ui;
using Wpf.Ui.Controls;

namespace XC.WpfHost.Extensions
{
    public static class SnackbarShowExtension
    {
        public static void SnackbarShowInfo(this string message,int delayTime=3)
        {
            var service=  App.GetService<ISnackbarService>();
            if (service != null)
            {
                ControlAppearance _snackbarAppearance = ControlAppearance.Info;
                service.Show("温馨提示", message, _snackbarAppearance, null, TimeSpan.FromSeconds(delayTime));
            }
        }
        public static void SnackbarShowWarn(this string message, int delayTime = 3)
        {
            var service = App.GetService<ISnackbarService>();
            if (service != null)
            {
                ControlAppearance _snackbarAppearance = ControlAppearance.Primary;
                service.Show("警告提示", message, _snackbarAppearance, null, TimeSpan.FromSeconds(delayTime));
            }
        }
        public static void SnackbarShowError(this string message, int delayTime = 3)
        {
            var service = App.GetService<ISnackbarService>();
            if (service != null)
            {
                ControlAppearance _snackbarAppearance = ControlAppearance.Danger;
                service.Show("错误提示", message, _snackbarAppearance, null, TimeSpan.FromSeconds(delayTime));
            }
        }
    }
}
